home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.earthlink.net!pete-s-computer
- From: brunop@earthlink.net (Peter Bruno)
- Newsgroups: comp.lang.c++
- Subject: Help: File counting lines
- Date: Thu, 07 Mar 96 20:48:08 GMT
- Organization: Earthlink Network, Inc.
- Message-ID: <4hni12$qst@bolivia.it.earthlink.net>
- NNTP-Posting-Host: pool016.max12.new-york.ny.dynip.alter.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=US-ASCII
- Summary: Counting lines in ASCII file
- X-Newsreader: News Xpress 2.0 Beta #0
- Keyword: Help
-
- Does anyone have any suggestions on a fast way to count the number of lines in
- a ASCII file. Each line is terminted by a <enter> and all I need to do is
- count the number of lines (records) in the file.
-
- The way I've been doing it is by: fgets(row, 128, File); count++;
- however, if the line is longer then 128 characters this does not work and it
- would seem that there must be a better way of doing it anyway... perhaps by
- incrementing the pointer until EOF??
-
- Any assistance would be greatly appreciated...
-
- Thanx,
-
- Peter Bruno
- brunop@earthlink.net
-